package com.pds.utils;

import com.pds.system.domain.FileUpload;

import java.util.HashMap;
import java.util.Map;

/**
 * 将FileUpload封装为map
 */
public class FileUtil {

    /**
     * 封装文件信息
     * @param fileUpload
     * @return map
     *           - fileId:文件id
     *           - fileName:文件名称
     *           - fileUrl:文件预览路径
     */
    public static Map structureFile(FileUpload fileUpload) {
        if(fileUpload == null){
            return null;
        }
        Map temp = new HashMap(3);
        temp.put("fileId",fileUpload.getAttachmentId());
        temp.put("fileName",fileUpload.getFileName());
        temp.put("fileUrl",fileUpload.getUrl());
        return temp;
    }
}
